package ts.test.test;

import cn.interestingshop.dao.BaseDaoImpl;
import cn.interestingshop.dao.IBaseDao;
import cn.interestingshop.entity.Classify;

import java.lang.reflect.Method;
import java.sql.ResultSet;

public class ShiZhan3 {
    public static void main(String[] args) {
        try  {
            // 获取类对象
            Class clazz = Class.forName("ts.test.test.Parson");
            Method method = clazz.getDeclaredMethod("getAge",null);
            method.setAccessible(true);
            Object person = method.invoke(null , null);
            System.out.println("年龄是："+ person);

            Object person1 = clazz.newInstance();
            Method person2 = clazz.getDeclaredMethod("silentMethod", null);
            person2.setAccessible(true);
            person2.invoke(person1, null);
            Method  person3 = clazz.getDeclaredMethod("setName", String.class);
            person3.invoke(person1, "老六");
            Object returnName = clazz.getDeclaredMethod("getName").invoke(person1);
            System.out.println("刚刚设定的name是："+returnName);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
